All Questions
13 questions
4votes
1answer
1kviews
Task Scheduler - LeetCode Challenge
I was attempting to solve this problem Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be ...
2votes
2answers
136views
CodeChef Chewing challenge
The ZCO is today and I did 5 problems to prepare for it overnight. One of the problems is the CodeChef Chewing problem. The code takes an integer N that specifies the number of chewing gums, integer ...
6votes
1answer
131views
Returns all primes p between m <= p <= n
This is my submission for the Prime Generator on SPOJ and it was accepted. Are there any improvements/changes I can make? Input: The input begins with the number \$t\$ of test cases in a single ...
3votes
1answer
1kviews
Detecting cycles
This is a challenge question from codeeval.com: Given a sequence, write a program to detect cycles within it. Input sample: Your program should accept as its first argument a path to a ...
5votes
1answer
2kviews
Minimum number of coins - (dynamic programming solution - topdown approach)
This is a problem from topcoder tutorials Given a list of N coins, their values (V1, V2, ... , VN), and the total sum S. Find the minimum number of coins the sum of which is S (we can use as many ...
4votes
2answers
2kviews
Project Euler - Smallest multiple
Here's Problem 5 - Smallest multiple 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly ...
3votes
4answers
8kviews
Hacker Rank - Lonely Integer
This is the problem statement for Lonely Integer. There are N integers in an array A. All but one integer occur in pairs. Your task is to find out the number that occurs only once. Input ...
4votes
1answer
838views
UVA 10474 - “Where is the marble?”
I have been solving the problem from UVA 10474. In this problem, there will be marbles with numbers written on them. For example suppose five marbles with numbers 50 , 43, 43, 43, 2, 90, 44. There ...
3votes
2answers
575views
Max path sum algorithm
This is for Project Euler question 18 and I'm looking for feedback on whether my algorithm is incorrect or whether I've just implemented it wrong (which I don't think is the case after some testing). ...
7votes
2answers
2kviews
Project Euler #22 - Name scores
I have written code in C++ 11 and check output with Project Euler site, and it is correct. I am not showing output, just to keep it secret, at least from my end. Please review my C++ 11 code. ...
2votes
1answer
786views
Level-traverse a binary tree
Level traverse binary tree question: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree <...
6votes
2answers
6kviews
Project Euler #12 - highly divisible triangular number
The following is a solution to Project Euler problem number 12: which is to find the first triangular number with more than 500 divisors. The code takes far too long to complete (over 10 minutes). Is ...
5votes
2answers
956views
Count Scorecards challenge problem related to partition number theory
I am having a challenge problem. I have solved the problem but my solution is slow. The problem is basically the distribution of scores among players. e.g for a 2 player game the possible scorecards ...